package web.pojo.query;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import java.math.BigDecimal;
import java.time.Instant;

import static constant.DateTimeConstant.DATE_TIME_FORMAT;
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;

@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "基本查询对象：时间参数、关键字")
public class BaseQuery {
    private static final long serialVersionUID = -4784727510705791412L;

    @DateTimeFormat(pattern = DATE_TIME_FORMAT)
    @Schema(description = "开始时间", example = "test")
    Instant startTime;

    @DateTimeFormat(pattern = DATE_TIME_FORMAT)
    @Schema(description = "结束时间", example = "test")
    Instant finishTime;

    @Schema(description = "关键字", example = "test")
    String keyword;

    @JsonIgnore
    @NumberFormat(pattern = "###,###.###")
    @Schema(description = "测试 @NumberFormat", example = "987.50", hidden = true, accessMode = READ_ONLY)
    BigDecimal salary;
}